package com.hqd.jjvm.util;

public class NumParseUtil {

	public static int[] longParserInt(long val) {
		int lowBits = (int) (0xFFFFFFFFl & val);
		int highBits = (int) ((0xFFFFFFFF00000000l & val) >> 32);
		return new int[]{lowBits, highBits};
	}

	public static long intParserLong(int lowBits, int highBits) {
		long high = (highBits & 0x000000ffffffffL) << 32;
		long low = lowBits & 0x00000000ffffffffL;
		return high | low;
	}

	public static int[] doubleParserInt(double val) {
		long num = Double.doubleToLongBits(val);
		return longParserInt(num);
	}

	public static double intParserDouble(int lowBits, int highBits) {
		long num = intParserLong(lowBits, highBits);
		return Double.longBitsToDouble(num);
	}
}
